<?php
namespace Modules\ShopApi\Http\Controllers\v1;
use Illuminate\Http\Request;
use Modules\AuthAdmin\Http\Requests\CommonIdRequest;
use Modules\ShopApi\Models\ShopPicture as ShopPictureModel;
use Modules\ShopApi\Models\ShopProduct as ShopProductModel;
use Modules\ShopApi\Models\ShopOrder as ShopOrderModel;
use Modules\ShopApi\Models\ShopPictureCollection as ShopPictureCollectionModel;
class IndexController extends CommonController
{ 
	/**
	 * @name  轮播图
	 * @method  GET
	 * @return  JSON
	 */
    public function get_banner(Request $request)
    {
		return (new ShopPictureModel())->get_banner();
    }
	/**
	 * @name  轮播图详情
	 * @method  GET
	 * @param  id int 轮播图id	
	 * @return  JSON
	 */
    public function swiper_detail(CommonIdRequest $request)
    {
		return (new ShopPictureModel())->swiper_detail($request->get('id'));
    }
	/**
	 * @name  直播详情
	 * @method  GET
	 * @param  id int 轮播图id	
	 * @return  JSON
	 */
    public function pic_detail(CommonIdRequest $request)
    {
		return (new ShopPictureModel())->pic_detail($request->get('id'));
    }
	/**
	 * @name  往期直播列表
	 * @method  GET
	 * @param  page int 页码	
	 * @return  JSON
	 */
    public function get_live_list(Request $request)
    {
		return (new ShopPictureModel())->get_live_list();
    }
	/**
	 * @name  我的直播收藏
	 * @method  GET
	 * @param  page int 页码	
	 * @return  JSON
	 */
    public function get_my_live_list(Request $request)
    {
		return (new ShopPictureCollectionModel())->get_my_live_list();
    }
	/**
	 * @name  直播收藏
	 * @method  POST
	 * @param  id int 商品id	
	 * @return  JSON
	 */
    public function picture_collection(CommonIdRequest $request)
    {
		return (new ShopPictureModel())->picture_collection($request->get('id'));
    }
	/**
	 * @name  商品列表
	 * @method  GET
	 * @param  page int 页码	
	 * @param  name string 商品名称	
	 * @param  sales int 销量：1=从多到少，0=从少到多	
	 * @param  size_money int 综合：0=默认，1=价格升序，2=价格降序
	 * @param  product_type_id int 商品分类id
	 * @return  JSON
	 */
    public function get_product(Request $request)
    {
		return (new ShopProductModel())->get_product($request->all());
    }
	/**
	 * @name  商品详情
	 * @method  GET
	 * @param  id int 商品id	
	 * @return  JSON
	 */
    public function get_product_detail(CommonIdRequest $request)
    {
		return (new ShopProductModel())->get_product_detail($request->get('id'));
    }
	/**
	 * @name  商品收藏
	 * @method  POST
	 * @param  id int 商品id	
	 * @return  JSON
	 */
    public function product_collection(CommonIdRequest $request)
    {
		return (new ShopProductModel())->product_collection($request->get('id'));
    }
	/**
	 * @name  提交订单页
	 * @method  GET
	 * @param  num int 购买数量	
	 * @param  product_id int 商品id	
	 * @param  specs string 已选规格内容
	 * @param  specs_id int 商品规格id
	 * @return  JSON
	 */
    public function get_submit_order(Request $request)
    {
		return (new ShopOrderModel())->get_submit_order($request->all());
    }
	/**
	 * @name  提交订单支付
	 * @method  POST
	 * @param  num int 购买数量	
	 * @param  product_id int 商品id	
	 * @param  specs string 已选规格内容
	 * @param  comment string 备注
	 * @param  specs_id int 商品规格id
	 * @return  JSON
	 */
    public function submit_order_pay(Request $request)
    {
		return (new ShopOrderModel())->submit_order_pay($request->all());
    }
	/**
	 * @name  获取商品小程序码
	 * @method  POST
	 * @param  id int 商品id
	 * @return  JSON
	 */
    public function app_code(Request $request)
    {
		return (new ShopProductModel())->app_code($request->get('id'));
    }
}
